
<!DOCTYPE html>
<html lang="en" class="loading">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>gitee的上传方法 - 陌闻</title>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="google" content="notranslate" />
    <meta name="keywords" content="Fechin,"> 
    <meta name="description" content="

上传的步骤方法1.gitee关联本地已有项目(当前步骤是基于本地先有项目，再在git 上新建仓库)①git init #初始化
如果已存在.git文件夹可以跳过这一步
②git remote a,"> 
    <meta name="author" content="陌闻"> 
    <link rel="alternative" href="atom.xml" title="陌闻" type="application/atom+xml"> 
    <link rel="icon" href="/myblog/img/favicon.png"> 
    
    
<link rel="stylesheet" href="/myblog/css/diaspora.css">

<meta name="generator" content="Hexo 5.4.0"></head>

<body class="loading">
    <span id="config-title" style="display:none">陌闻</span>
    <div id="loader"></div>
    <div id="single">
    <div id="top" style="display: block;">
    <div class="bar" style="width: 0;"></div>
    <a class="iconfont icon-home image-icon" href="javascript:;" data-url="http://strange-news.gitee.io/myblog"></a>
    <div title="播放/暂停" class="iconfont icon-play"></div>
    <h3 class="subtitle">gitee的上传方法</h3>
    <div class="social">
        <div>
            <div class="share">
                <a title="获取二维码" class="iconfont icon-scan" href="javascript:;"></a>
            </div>
            <div id="qr"></div>
        </div>
    </div>
    <div class="scrollbar"></div>
</div>

    <div class="section">
        <div class="article">
    <div class='main'>
        <h1 class="title">gitee的上传方法</h1>
        <div class="stuff">
            <span>四月 15, 2021</span>
            
  <ul class="post-tags-list" itemprop="keywords"><li class="post-tags-list-item"><a class="post-tags-list-link" href="/myblog/tags/gitee/" rel="tag">gitee</a></li></ul>


        </div>
        <div class="content markdown">
            <!-- Welcome to [Hexo](https://hexo.io/)! This is your very first post. Check [documentation](https://hexo.io/docs/) for more info. If you get any problems when using Hexo, you can find the answer in [troubleshooting](https://hexo.io/docs/troubleshooting.html) or you can ask me on [GitHub](https://github.com/hexojs/hexo/issues). -->

<h3 id="上传的步骤方法"><a href="#上传的步骤方法" class="headerlink" title="上传的步骤方法"></a>上传的步骤方法</h3><h4 id="1-gitee关联本地已有项目-当前步骤是基于本地先有项目，再在git-上新建仓库"><a href="#1-gitee关联本地已有项目-当前步骤是基于本地先有项目，再在git-上新建仓库" class="headerlink" title="1.gitee关联本地已有项目(当前步骤是基于本地先有项目，再在git 上新建仓库)"></a>1.gitee关联本地已有项目(当前步骤是基于本地先有项目，再在git 上新建仓库)</h4><p>①git init #初始化</p>
<p>如果已存在.git文件夹可以跳过这一步</p>
<p>②git remote add origin 你的仓库地址(.git结尾)</p>
<p>③git pull origin master</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fatal:couldn’t find remote ref master</span><br></pre></td></tr></table></figure>
<p style="color: red;">*如果报这个错误表明远程仓库当前是空的，跳过这一步直接提交即可</p>
④依次执行下面的三行指令，则提交成功

<p>git add .</p>
<p>git commit -m “当次提交版本的自定义备注”</p>
<p>git push origin master</p>
<p>⑤之后每一次修改过后都执行第4部的3个操作提交本地修改的代码</p>
<p>⑥每次开始新编码或换电脑(协同开发换人)时都要执行</p>
<p>git pull origin master #从远程拖取最新</p>
<h3 id="踩坑的解决方案"><a href="#踩坑的解决方案" class="headerlink" title="踩坑的解决方案"></a>踩坑的解决方案</h3><h4 id="1-403错误"><a href="#1-403错误" class="headerlink" title="1.403错误"></a>1.403错误</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">emote: You <span class="keyword">do</span> not have permi ssion push to this reposi tory</span><br><span class="line">fatal: unable to accesshttps://gi tee. com/hi xztx/ xzb1og. git/<span class="string">&#x27;</span></span><br><span class="line"><span class="string"> : The requested URL returned error: 403 </span></span><br></pre></td></tr></table></figure>

<p>问题:当前电脑配置的git.上账号和密码不具有这个项目的权限(因为设了私有)</p>
<p>解决办法:</p>
<p>①windows+r弹出的输入框中输入命令rundll32.exe keymgr .II,KRShowKeyMgr</p>
<p>②将gitee相关条目删除重新添加或点编辑修改用户名和密码</p>
<p>确定保存后关闭</p>
<p>③重新执行git push -u origin master提交代码即可成功</p>
<h4 id="2-push失败"><a href="#2-push失败" class="headerlink" title="2.push失败"></a>2.push失败</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">To https://gi tee. com/hi xztx/ xzb1og. git</span><br><span class="line">! [re jected]</span><br><span class="line">master -&gt;</span><br><span class="line">master (non- fast- f orward)</span><br><span class="line">error: fai led to push some refs to https:/ /gi tee. com/hi xztx/ xzblog. git</span><br><span class="line">hint: Updates were rejected because the tip of your current branch is behind</span><br><span class="line">hint: its remote counterpart. Integrate the remote changes (e. g.</span><br><span class="line">hint : git pul1... ) before pushing again.</span><br><span class="line">hint: See the Note about fast f orwards <span class="keyword">in</span> git push --he1p” <span class="keyword">for</span> details.</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>问题，远程仓库有更新，本地未取最新</p>
<p>解决办法:</p>
<p>①先拉取最新远程仓库内容</p>
<p>git pull origin master</p>
<p>②再执行push</p>
<p>git push origin master</p>
<p>即可成功</p>
<p style="color: red;">*如果在Gitee平台仓库上已经存在readme或其他文件，在提交时可能会存在冲突，这时用户需要
选择的是保留线.上的文件或者舍弃线上的文件，如果您舍弃线上的文件，则在推送时选择强制推送，
强制推送需要执行下面的命令(默认不推荐该行为):</p>
<p style="color: red;">git push origin master- f</p>

            <!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->
            <audio id="audio" loop="1" preload="auto" controls="controls" data-autoplay="false">
                <source type="audio/mpeg" src="">
            </audio>
            
                <ul id="audio-list" style="display:none">
                    
                        
                            <li title='0' data-url='http://link.hhtjim.com/163/425570952.mp3'></li>
                        
                    
                        
                            <li title='1' data-url='http://link.hhtjim.com/163/425570952.mp3'></li>
                        
                    
                </ul>
            
        </div>
        
    <div id='gitalk-container' class="comment link"
		data-enable='false'
        data-ae='false'
        data-ci=''
        data-cs=''
        data-r='myblog'
        data-o='strange-news'
        data-a='strange-news'
        data-d='false'
    >查看评论</div>


    </div>
    
</div>


    </div>
</div>
<script src="/myblog/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/myblog/live2dw/assets/kesyoban.model.json"},"display":{"position":"right","width":200,"height":300,"opacity":0.8},"mobile":{"show":true,"scale":0.5},"log":false});</script></body>


<script src="//lib.baomitu.com/jquery/1.8.3/jquery.min.js"></script>
<script src="/myblog/js/plugin.js"></script>
<script src="/myblog/js/typed.js"></script>
<script src="/myblog/js/diaspora.js"></script>


<link rel="stylesheet" href="/myblog/photoswipe/photoswipe.css">
<link rel="stylesheet" href="/myblog/photoswipe/default-skin/default-skin.css">


<script src="/myblog/photoswipe/photoswipe.min.js"></script>
<script src="/myblog/photoswipe/photoswipe-ui-default.min.js"></script>


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>
    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">
        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>
        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">
            <div class="pswp__top-bar">
                <!--  Controls are self-explanatory. Order can be changed. -->
                <div class="pswp__counter"></div>
                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
                <button class="pswp__button pswp__button--share" title="Share"></button>
                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                      <div class="pswp__preloader__cut">
                        <div class="pswp__preloader__donut"></div>
                      </div>
                    </div>
                </div>
            </div>
            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div> 
            </div>
            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>
            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>
            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>
        </div>
    </div>
</div>






</html>
